<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<!--移动设备有限-->
		<meta name="viewport" content="width=device-width, initial-scale=1">
		<link rel="stylesheet" href="bootstrap/css/bootstrap.css">
		<!--引入Jquery-->
		<script src="bootstrap/js/jquery.js" type="text/javascript" charset="utf-8"></script>
		<script src="bootstrap/js/bootstrap.js" type="text/javascript" charset="utf-8"></script>
		<title></title>
		<style type="text/css">
			body{
				background: url("../../assets/images/bg.jgp.jpeg");
				width: 100%;
				height: 100vh;
				background-repeat: no-repeat;
				background-size: 100% 100%;
			}
			td {
				text-align: center;
			}
			.container{
				margin-top: 100px;
				background-color: rgba(255, 255, 255, 0.64);
				width: 400px;
				border-radius: 5px;
				padding-top: 10px;
				padding-bottom: 20px;
			}
		</style>
	</head>
	<body>
		<div class="container">
			<table class="table" style="width: 300px;margin: 0 auto;">
				<caption class="h1 text-center bg-info">管理员登录</caption>
				<tr class=" text-center">
					<td>用户名:</td>
					<td>
						<input type="text" id="name" class="form-control"/>
					</td>
				</tr>
				<tr class=" text-center">
					<td>密码:</td>
					<td>
						<input type="password" id="password" class="form-control"/>
					</td>
				</tr>
				<tr>
					<td colspan="2"><button class="btn btn-info" onclick="login()">登录</button>
						<button class="btn btn-info" onclick="register()">注册新用户</button>
					</td>
				</tr>
				</tr>
			</table>
		</div>
	<script>
		if(is_login()){
			window.location.href="../../index.html";
		}
		function register() {
			window.location.href="注册.html";
		}
		function is_login() {
			if(localStorage.getItem("user_name")!=null){
				return true;
			}
			return false
		}
		function login() {
			localStorage.setItem("user_name",$("#name").val())
			window.location.href="../../index.html"
			// var user_info="";
			// if((user_info=localStorage.getItem($("#name").val()))!=null){
			// 	user_info=JSON.parse(user_info);
			// 	if($("#password").val()==user_info['password']){
			// 		localStorage.setItem("user_name",$("#name").val());
			// 		alert("登录成功！");
			// 		window.location.href="../../index.html";
			// 	}else {
			// 		alert("密码错误")
			// 	}
			// }
			// else {
			// 	alert("用户不存在");
			// }
		}
	</script>
	</body>
</html>
